//
//  SPWriteOrderInfoHeaderView.m
//  panzer
//
//  Created by 还带大道 on 2018/10/23.
//  Copyright © 2018年 还带大道. All rights reserved.
//

#import "SPWriteOrderInfoHeaderView.h"
#import "SPSelectCompanyView.h"
#import "SPCommon.h"

@interface SPWriteOrderInfoHeaderView()

@property (weak, nonatomic) IBOutlet UIImageView *arrow;

@end

@implementation SPWriteOrderInfoHeaderView

+ (instancetype)shareHeaderView
{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil].lastObject;
}


- (void)awakeFromNib
{
    [super awakeFromNib];
    //改变图片方向
    UIImage *image = [UIImage imageWithCGImage:self.arrow.image.CGImage scale:2.0 orientation:UIImageOrientationRight];
    self.arrow.image = image;
    _select_index = -1;
}


- (IBAction)selec {
    
    SPSelectCompanyView *selectV = [SPSelectCompanyView shareHeaderView];
    selectV.expressList = self.expressList;
    selectV.select_index = _select_index;
    selectV.selectBlock = ^(NSInteger index) {
        self.select_index = index;
        if(0 <index < self.expressList.count){
            self.name.text = self.expressList[index][@"text"];
        }
    };
    selectV.frame = RZ_KEYWINDOW.bounds;
    [RZ_KEYWINDOW addSubview:selectV];
    [RZ_KEYWINDOW endEditing:YES];
}

@end
